const worker = new Worker('./worker.js')

worker.onmessage = function (event) {
  const result = event.data
  console.log(`Result from worker: ${result}`)
}

worker.postMessage(5)